package com.ht.controller;

import com.ht.data.Result;
import com.ht.domain.bo.TbScheduleBO;
import com.ht.feign.PublicOutpatientFeign;
import com.ht.service.TbDoctorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController  //等于@Restquest + @Controller
@RequestMapping("/expertsOutpatient")
@Api("专家门诊挂号管理系统")
@RefreshScope  //实时刷新
public class ExpertsOutpatientController {

    @Autowired
    private TbDoctorService tbDoctorService;

    @Resource
    private PublicOutpatientFeign publicOutpatientFeign;

    @GetMapping("/queryDepartment")
    @ApiOperation("查询所有科室")
    @ApiImplicitParam()
    public Result queryDepartment(){
        Result all = publicOutpatientFeign.findDepartmentAll();
        return all;
    }



    @GetMapping("/queryExpertByDepartmentId/{departmentId}")
    @ApiOperation("根据科室id查询医生表信息")
    @ApiImplicitParam(name="departmentId",value = "科室id",required = true,paramType = "path")
    public Result queryPublicById(@PathVariable("departmentId") Long departmentId){
        List<TbScheduleBO> list = tbDoctorService.queryExpertByDepartmentId(departmentId);
        return Result.OK().setData(list);
    }



}
